home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / cnews.src.lzh / relay / article.c < prev    next >
C/C++ Source or Header  |  1989-06-27  |  1KB  |  55 lines

  1. /*
  2.  * article creation and destruction
  3.  */
  4. #include <stdio.h>
  5. #ifndef AMIGA
  6. #  include <sys/types.h>
  7. #endif /* AMIGA */
  8. #include "libc.h"
  9. #include "news.h"
  10. #include "headers.h"
  11. #include "article.h"
  12.  
  13. void
  14. artinit(art)
  15. register struct article *art;
  16. {
  17.     art->a_status = ST_OKAY;
  18.     hdrinit(&art->h);
  19.     art->a_haccum = NULL;
  20.     art->a_hnext = NULL;
  21.     art->a_hpalloced = 0;
  22.     art->a_hpused = 0;
  23.     art->a_hptrs = NULL;
  24.     art->a_hbytesleft = 0;
  25.     art->a_files = NULL;
  26.     art->a_tmpf = NULL;
  27.     art->a_artf = NULL;
  28.     art->a_unlink = NO;
  29.     art->a_filed = NO;
  30.     art->a_xref = NO;
  31.     art->a_blvmax = NO;
  32.     art->a_charswritten = 0;
  33.     art->a_unread = 0;
  34. }
  35.  
  36. void
  37. artfree(art)
  38. register struct article *art;
  39. {
  40.     freeheaders(&art->h);
  41.     /* a_haccum is currently not malloced */
  42.     art->a_hptrs = NULL;        /* don't free a_hptrs; see hdrsave() */
  43.     nnfree(&art->a_files);
  44.     nnfree(&art->a_tmpf);
  45.     if (art->a_artf != NULL) {
  46.         (void) fprintf(stderr, "%s: a_artf still open in artfree()\n",
  47.             progname);
  48.         if (nfclose(art->a_artf) == EOF) {
  49.             art->a_status |= ST_DROPPED;
  50.             warning("error closing %s", art->a_tmpf);
  51.         }
  52.         art->a_artf = NULL;
  53.     }
  54. }
  55.